home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 42
/
Amiga Format AFCD42 (Issue 126, Aug 1999).iso
/
-coverdisks-
/
126a
/
football
/
user
/
cup_viewhistory.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1999-05-22
|
5KB
|
188 lines
/* ***********************************************************************
VIEW TEAM SCHEDULE PROGRAM FOR FOOTBALL REXX SUITE
----------------------------------------------------
Copyright Mark Naughton 1997
Version Date History
--------------------------------------------------------------------------
1.0 091297 First release.
151297 Tidied display.
210499 Added support for CloseCup. History file would not be
found as it did not have the date appended to the
filename.
**************************************************************************
Procedure
---------
1. Check file exists. If it doesn't, format a new filename from the
original, and then check this file.
2. Open '.cfh' file and read in winners, storing them and if the name
appears more than once, increment the number of wins for that team.
3. Read '.cfh' file in and store 'needed' lines.
4. Write teams for winners out to temp file and sort.
4. Check array and set marker if third place is found.
5. Display message. Display winners, runnersup, third place and fourth.
6. Read temp file and display winners with total wins. Exit.
************************************************************************** */
PARSE ARG league_stuff
version = 1
input_file = '.cfh'
first = '*WINNER='
second = '*RUNNERUP='
second = '*THIRD='
second = '*FOURTH='
cupnm = '** History for '
separator = '*'
teams. = '???'
wins. = '???'
lines. = '???'
counter = 0
league_file = "Data/" || league_stuff
if exists(league_file || input_file) = 0 then do
parse var league_file nlf "_" .
if exists(nlf || input_file) = 0 then exit
league_file = nlf
end
if open(datafile,league_file || input_file,'r') then do
do while ~eof(datafile)
line = readln(datafile)
if pos(cupnm,line) > 0 then
cupname = delstr(line,1,15)
if pos(first,line) > 0 then do
name = delstr(line,1,8)
notin = 0
do i=1 to counter
if pos(name,teams.i) > 0 then do
wins.i = wins.i + 1
notin = 1
end
end
if notin = 0 then do
counter = counter + 1
teams.counter = name
wins.counter = 1
end
end
end
close(datafile)
end
else do
say
say "ERROR : (ViewHistory)"
say
say "Cannot open '"league_file||input_file"' for reading."
exit
end
linect = 0
if open(datafile,league_file || input_file,'r') then do
do while ~eof(datafile)
line = readln(datafile)
if pos('**',line) = 0 & length(line) > 2 & line ~= '' then do
linect = linect + 1
lines.linect = line
end
end
close(datafile)
end
else do
say
say "ERROR : (ViewHistory)"
say
say "Cannot open '"league_file||input_file"' for reading."
exit
end
if counter > 1 then do
if open(datafile,"RAM:Football.tempcup",'w') then do
do i=1 to counter
writeln(datafile,left(wins.i,4)" "teams.i)
end
close(datafile)
end
else do
say
say "ERROR : (ViewHistory)"
say
say "Cannot create temporary file."
exit
end
address command 'Exec/Sort4Chars '
end
thirdp = 0
do i=1 to linect
if pos(third,lines.i) > 0 then do
thirdp = 1
leave
end
end
say
say center("Display Cup History for "cupname,78)
say "-------------------------------------------------------------------------------"
say
do i=1 to linect
name = delstr(lines.i,1,8)
say "Winner : "upper(name)
i = i + 1
name = delstr(lines.i,1,10)
say "Runner-Up : "name
if thirdp = 1 then do
i = i + 1
name = delstr(lines.i,1,7)
say "Third Place : "name
i = i + 1
name = delstr(lines.i,1,8)
say "Fourth Place : "name
say
end
else
say
end
say
say
say "Wins Team"
say "-------------------------------------------------------------------------------"
say
i = 0
if counter = 1 then do
say left(wins.1,4)" "upper(teams.1)
say
end
else do
if open(datafile,"RAM:Football.tempcup",'r') then do
do while ~eof(datafile)
line = readln(datafile)
if i = 0 then do
say upper(line)
i = 1
end
else
say line
end
close(datafile)
end
else do
say
say "ERROR : (ViewHistory)"
say
say "Cannot read temporary file of teams to display the table of winners."
exit
end
address command 'delete >NIL: RAM:Football.tempcup'
end
say "-------------------------------------------------------------------------------"
exit